<?php
	require_once("smarty/initSmarty.class.php");
	class WebPage extends InitSmarty
	{
		protected $skin;
		protected $title;
		public function __construct($skin)
		{
			parent::__construct();
			$this->title = "TEST";
			$this->skin = $skin;
			
			
			$user_id = WebApp::app()->db->select(array("id"), array('users'), "username = '" . Autorization::getName() . "' or 
																			   email = '" . Autorization::getName() . "'"
																			   );
																			   
			$role = WebApp::app()->db->select(array("*"), array("maskassignment"), "itemname = 'Admin' and user_id = " . $user_id[0]->id);
			if(empty($role))
			{
				$str = WebApp::app()->getBaseUrl();
				$count = strrpos($str, 'administrator/');
				$path = substr($str, 0, $count);
				header("Location:" . $path);
			}
			
		}
		
		public function display($page)
		{
			$this->assign("title", $this->title);
			parent::display($this->skin."/header.tpl");
			parent::display($this->skin."/".$page);
			parent::display($this->skin."/footer.tpl");
		}
	}
?>